import request from '@/utils/request'

// 查询库区信息列表
export function listArea(query) {
  return request({
    url: '/wms/area/list',
    method: 'get',
    params: query
  })
}

// 查询库区信息详细
export function getArea(id) {
  return request({
    url: '/wms/area/' + id,
    method: 'get'
  })
}

// 新增库区信息
export function addArea(data) {
  return request({
    url: '/wms/area',
    method: 'post',
    data: data
  })
}

// 修改库区信息
export function updateArea(data) {
  return request({
    url: '/wms/area',
    method: 'put',
    data: data
  })
}

// 删除库区信息
export function delArea(id) {
  return request({
    url: '/wms/area/' + id,
    method: 'delete'
  })
}

// 根据仓库ID查询库区列表
export function getAreasByWarehouseId(warehouseId) {
  return request({
    url: '/wms/area/warehouse/' + warehouseId,
    method: 'get'
  })
}

// 检查库区编码唯一性
export function checkAreaCodeUnique(areaCode, warehouseId, id) {
  return request({
    url: '/wms/area/checkAreaCodeUnique',
    method: 'get',
    params: {
      areaCode: areaCode,
      warehouseId: warehouseId,
      id: id
    }
  })
}